﻿//GB/Z 29014.3 ISYC 304-12-整体心轴式锯片铣刀

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{
    class ISYC_304_12_F47
    {
        public static void ISYC_304_F47_H(Dictionary<string, Object> data)  //锯片铣刀
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中性线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //基本参数-------------------------------------------------------------------------------------------------
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            //作图
            //参数
            //double pi = Math.PI;
            double sdc = Convert.ToDouble(data["dc"]);
            double scale = Convert.ToDouble(data["scale"]); //放大系数
            if (scale == 0)
            {
                if (sdc < 45)
                {
                    scale = 4.0;
                }
                else if (sdc < 60)
                {
                    scale = 3.0;
                }
                else if (sdc < 90)
                {
                    scale = 2.0;
                }
                else if (sdc < 120)
                {
                    scale = 1.5;
                }
                else if (sdc < 180)
                {
                    scale = 1.0;
                }
                else if (sdc < 240)
                {
                    scale = 0.75;
                }
                else if (sdc < 360)
                {
                    scale = 0.5;
                }
                else
                {
                    scale = 0.25;
                }
            }
            double dc = Convert.ToDouble(data["dc"]) * scale;
            double dcon = Convert.ToDouble(data["dcon"]) * scale;
            double oal = Convert.ToDouble(data["oal"]) * scale;
            double dhub = Convert.ToDouble(data["dhub"]) * scale;
            double cw = Convert.ToDouble(data["cw"]) * scale;
            double hhub = Convert.ToDouble(data["hhub"]) * scale;
            double dah = Convert.ToDouble(data["dah"]) * scale;
            double dbhc = Convert.ToDouble(data["dbhc"]) * scale;
            double bcdpax = Convert.ToDouble(data["bcdpax"]) * scale;
            if (bcdpax == 0)
            {
                bcdpax = 2 * scale;
            }
            double bcd = Convert.ToDouble(data["bcd"]) * scale;
            double isframe = Convert.ToDouble(data["isframe"]);

            //坐标
            //主视图
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(0, dbhc / 2);
            Vector2 v3 = new Vector2(dbhc / 2, 0);
            Vector2 v4 = new Vector2(v2.X, -v2.Y);
            Vector2 v5 = new Vector2(-v3.X, 0);
            Vector2 v6 = new Vector2(-oal + hhub, v5.Y);
            Vector2 v7 = new Vector2(-dc / 2 - 2, 0);
            Vector2 v8 = new Vector2(dc / 2 + 2, 0);
            Vector2 v9 = new Vector2(0, dc / 2 + 2);
            Vector2 v10 = new Vector2(0, -v9.Y);
            Vector2 v11 = new Vector2(189 + cw / 2, dc / 2);
            Vector2 v12 = new Vector2(189 + oal / 2 - hhub, bcd / 2);
            Vector2 v13 = new Vector2(v12.X, dhub / 2);
            Vector2 v14 = new Vector2(189 + oal / 2, v13.Y);
            Vector2 v15 = new Vector2(v14.X, -v14.Y);
            Vector2 v16 = new Vector2(v13.X, -v13.Y);
            Vector2 v17 = new Vector2(v12.X, -v12.Y);
            Vector2 v18 = new Vector2(v11.X, -v11.Y);
            Vector2 v19 = new Vector2(189 - cw / 2, v18.Y);
            Vector2 v20 = new Vector2(189 - oal / 2 + hhub, v17.Y);
            Vector2 v21 = new Vector2(v20.X, v16.Y);
            Vector2 v22 = new Vector2(189 - oal / 2, v15.Y);
            Vector2 v23 = new Vector2(v22.X, v14.Y);
            Vector2 v24 = new Vector2(v21.X, v13.Y);
            Vector2 v25 = new Vector2(v20.X, v12.Y);
            Vector2 v26 = new Vector2(v19.X, v11.Y);
            Vector2 v27 = new Vector2(v26.X + bcdpax * (cw - oal + 2 * hhub) / (dc - bcd), v26.Y - bcdpax);
            Vector2 v28 = new Vector2(v11.X - bcdpax * (cw - oal + 2 * hhub) / (dc - bcd), v27.Y);
            Vector2 v29 = new Vector2(v14.X, dbhc / 2 + dah / 2);
            Vector2 v30 = new Vector2(v23.X, v29.Y);
            Vector2 v31 = new Vector2(v30.X, v30.Y - dah);
            Vector2 v32 = new Vector2(v29.X, v31.Y);
            Vector2 v33 = new Vector2(v32.X, dcon / 2);
            Vector2 v34 = new Vector2(v31.X, v33.Y);
            Vector2 v35 = new Vector2(v34.X, -v34.Y);
            Vector2 v36 = new Vector2(v33.X, v35.Y);
            Vector2 v37 = new Vector2(v32.X, -v32.Y);
            Vector2 v38 = new Vector2(v31.X, -v31.Y);
            Vector2 v39 = new Vector2(v30.X, -v30.Y);
            Vector2 v40 = new Vector2(v29.X, -v29.Y);
            Vector2 v41 = new Vector2(v28.X, -v28.Y);
            Vector2 v42 = new Vector2(v27.X, -v27.Y);
            Vector2 v43 = new Vector2(v23.X - 2, 0);
            Vector2 v44 = new Vector2(v14.X + 2, 0);
            Vector2 v45 = new Vector2(v44.X, dbhc / 2);
            Vector2 v46 = new Vector2(v43.X, v45.Y);
            Vector2 v47 = new Vector2(v46.X, -v46.Y);
            Vector2 v48 = new Vector2(v45.X, v47.Y);

            //线段
            //主视图
            fun.drawcircle(dxf, v1, dcon / 2, 0.3, contour);
            LwPolyline Arc1 = new LwPolyline();
            Arc1.Vertexes.Add(new LwPolylineVertex(new Vector2(dbhc / 2, 0)));
            Arc1.Vertexes.Add(new LwPolylineVertex(new Vector2(-dbhc / 2, 0)));
            Arc1.Vertexes[0].Bulge = 1;
            fun.PolyFillandlinetype(dxf, Arc1, 0.15, refin, Linetype.Center);
            LwPolyline Arc2 = new LwPolyline();
            Arc2.Vertexes.Add(new LwPolylineVertex(new Vector2(dbhc / 2, 0)));
            Arc2.Vertexes.Add(new LwPolylineVertex(new Vector2(-dbhc / 2, 0)));
            Arc2.Vertexes[0].Bulge = -1;
            fun.PolyFillandlinetype(dxf, Arc2, 0.15, refin, Linetype.Center);
            fun.drawcircle(dxf, v1, dhub / 2, 0.3, contour);
            fun.drawcircle(dxf, v1, bcd / 2, 0.3, contour);
            fun.drawcircle(dxf, v1, dc / 2, 0.3, contour);
            fun.drawcircle(dxf, v2, dah / 2, 0.3, contour);
            fun.drawcircle(dxf, v3, dah / 2, 0.3, contour);
            fun.drawcircle(dxf, v4, dah / 2, 0.3, contour);
            fun.drawcircle(dxf, v5, dah / 2, 0.3, contour);
            Vector2[] Line1 = { v7, v8 };
            fun.drawPlinetype(dxf, Line1, 0.15, centre, Linetype.Center);
            Vector2[] Line2 = { v9, v10 };
            fun.drawPlinetype(dxf, Line2, 0.15, centre, Linetype.Center);
            Vector2[] Line3 = { v43, v44 };
            fun.drawPlinetype(dxf, Line3, 0.15, centre, Linetype.Center);
            Vector2[] Line4 = { v11, v12 };
            fun.drawBLine(dxf, Line4, 0.3, contour);
            Vector2[] Line5 = { v12, v13 };
            fun.drawBLine(dxf, Line5, 0.3, contour);
            Vector2[] Line6 = { v13, v14 };
            fun.drawBLine(dxf, Line6, 0.3, contour);
            Vector2[] Line7 = { v14, v15 };
            fun.drawBLine(dxf, Line7, 0.3, contour);
            Vector2[] Line8 = { v15, v16 };
            fun.drawBLine(dxf, Line8, 0.3, contour);
            Vector2[] Line9 = { v16, v17 };
            fun.drawBLine(dxf, Line9, 0.3, contour);
            Vector2[] Line10 = { v17, v18 };
            fun.drawBLine(dxf, Line10, 0.3, contour);
            Vector2[] Line11 = { v18, v19 };
            fun.drawBLine(dxf, Line11, 0.3, contour);
            Vector2[] Line12 = { v19, v20 };
            fun.drawBLine(dxf, Line12, 0.3, contour);
            Vector2[] Line13 = { v20, v21 };
            fun.drawBLine(dxf, Line13, 0.3, contour);
            Vector2[] Line14 = { v21, v22 };
            fun.drawBLine(dxf, Line14, 0.3, contour);
            Vector2[] Line15 = { v22, v23 };
            fun.drawBLine(dxf, Line15, 0.3, contour);
            Vector2[] Line16 = { v23, v24 };
            fun.drawBLine(dxf, Line16, 0.3, contour);
            Vector2[] Line17 = { v24, v25 };
            fun.drawBLine(dxf, Line17, 0.3, contour);
            Vector2[] Line18 = { v25, v26 };
            fun.drawBLine(dxf, Line18, 0.3, contour);
            Vector2[] Line19 = { v26, v11 };
            fun.drawBLine(dxf, Line19, 0.3, contour);
            Vector2[] Line20 = { v27, v28 };
            fun.drawBLine(dxf, Line20, 0.3, contour);
            Vector2[] Line21 = { v29, v30 };
            fun.drawBLine(dxf, Line21, 0.3, contour);
            Vector2[] Line22 = { v31, v32 };
            fun.drawBLine(dxf, Line22, 0.3, contour);
            Vector2[] Line23 = { v33, v34 };
            fun.drawBLine(dxf, Line23, 0.3, contour);
            Vector2[] Line24 = { v35, v36 };
            fun.drawBLine(dxf, Line24, 0.3, contour);
            Vector2[] Line25 = { v37, v38 };
            fun.drawBLine(dxf, Line25, 0.3, contour);
            Vector2[] Line26 = { v39, v40 };
            fun.drawBLine(dxf, Line26, 0.3, contour);
            Vector2[] Line27 = { v41, v42 };
            fun.drawBLine(dxf, Line27, 0.3, contour);
            Vector2[] Line28 = { v45, v46 };
            fun.drawPlinetype(dxf, Line28, 0.15, centre, Linetype.Center);
            Vector2[] Line29 = { v47, v48 };
            fun.drawPlinetype(dxf, Line29, 0.15, centre, Linetype.Center);

            //填充
            LwPolyline hatchpoly1 = new LwPolyline();
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v29));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v30));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v23));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v24));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v25));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v27));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v28));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v12));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v13));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v14));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v29));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            Arc[] harc1 = new Arc[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                }
                if (htype1[i] == "Arc")
                {
                    harc1[i] = (Arc)hatchpoly1.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, harc1, hatching);

            LwPolyline hatchpoly2 = new LwPolyline();
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v11));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v26));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v27));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v28));
            hatchpoly2.IsClosed = true;
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            Arc[] harc2 = new Arc[100];
            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst2; i++)
            {
                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                }
                if (htype2[i] == "Arc")
                {
                    harc2[i] = (Arc)hatchpoly2.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype2, hnumst2, 45, 1, hline2, harc2, contour);

            LwPolyline hatchpoly3 = new LwPolyline();
            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v31));
            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v32));
            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v33));
            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v34));
            hatchpoly3.IsClosed = true;
            String[] htype3 = new String[100];
            Line[] hline3 = new Line[100];
            Arc[] harc3 = new Arc[100];
            int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst3; i++)
            {
                htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype3[i] == "Line")
                {
                    hline3[i] = (Line)hatchpoly3.Explode()[i];
                }
                if (htype3[i] == "Arc")
                {
                    harc3[i] = (Arc)hatchpoly3.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype3, hnumst3, 45, 10 * scale, hline3, harc3, hatching);

            LwPolyline hatchpoly4 = new LwPolyline();
            hatchpoly4.Vertexes.Add(new LwPolylineVertex(v35));
            hatchpoly4.Vertexes.Add(new LwPolylineVertex(v36));
            hatchpoly4.Vertexes.Add(new LwPolylineVertex(v37));
            hatchpoly4.Vertexes.Add(new LwPolylineVertex(v38));
            hatchpoly4.IsClosed = true;
            String[] htype4 = new String[100];
            Line[] hline4 = new Line[100];
            Arc[] harc4 = new Arc[100];
            int hnumst4 = hatchpoly4.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst4; i++)
            {
                htype4[i] = hatchpoly4.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype4[i] == "Line")
                {
                    hline4[i] = (Line)hatchpoly4.Explode()[i];
                }
                if (htype4[i] == "Arc")
                {
                    harc4[i] = (Arc)hatchpoly4.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype4, hnumst4, 45, 10 * scale, hline4, harc4, hatching);

            LwPolyline hatchpoly5 = new LwPolyline();
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v39));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v40));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v15));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v16));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v17));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v41));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v42));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v20));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v21));
            hatchpoly5.Vertexes.Add(new LwPolylineVertex(v22));
            hatchpoly5.IsClosed = true;
            String[] htype5 = new String[100];
            Line[] hline5 = new Line[100];
            Arc[] harc5 = new Arc[100];
            int hnumst5 = hatchpoly5.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst5; i++)
            {
                htype5[i] = hatchpoly5.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype5[i] == "Line")
                {
                    hline5[i] = (Line)hatchpoly5.Explode()[i];
                }
                if (htype5[i] == "Arc")
                {
                    harc5[i] = (Arc)hatchpoly5.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype5, hnumst5, 45, 10 * scale, hline5, harc5, hatching);

            LwPolyline hatchpoly6 = new LwPolyline();
            hatchpoly6.Vertexes.Add(new LwPolylineVertex(v18));
            hatchpoly6.Vertexes.Add(new LwPolylineVertex(v19));
            hatchpoly6.Vertexes.Add(new LwPolylineVertex(v42));
            hatchpoly6.Vertexes.Add(new LwPolylineVertex(v41));
            hatchpoly6.IsClosed = true;
            String[] htype6 = new String[100];
            Line[] hline6 = new Line[100];
            Arc[] harc6 = new Arc[100];
            int hnumst6 = hatchpoly6.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst6; i++)
            {
                htype6[i] = hatchpoly6.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype6[i] == "Line")
                {
                    hline6[i] = (Line)hatchpoly6.Explode()[i];
                }
                if (htype6[i] == "Arc")
                {
                    harc6[i] = (Arc)hatchpoly6.Explode()[i];
                }
            }
            fun.hatchsub1(dxf, htype6, hnumst6, 45, 1, hline6, harc6, contour);

            //标注样式
            //箭头样式
            DimensionStyle dimensionStyle = fun.CreateDimStyle();
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;

            //文本样式
            dimensionStyle.TextHeight = 1.0;
            double offset = 10;
            double height = 1 * scale;
            double arrowsize = 1 * scale;
            double exline = 0.5 * scale;

            //坐标系
            fun.Axis(dxf, v1, 180, 270, "", "", "PCS,MCS", 0.1 * scale, height * 0.5, 0);
            fun.Axis(dxf, v2, 180, 270, "", "", "CIP", 0.1 * scale, height * 0.5, 0);
            fun.Axis(dxf, fun.Polar(v20, -120 * pi / 180, 19.36 * scale), 180, 270, "Z", "Y", "X", 0.1 * scale, height, 0);

            //线段尺寸标注
            //尺寸1
            LinearDimension dim1 = new LinearDimension(new Line(v19, v18), -offset, 0, dimensionStyle);
            dim1.UserText = "CW = " + Math.Round(cw / scale, 2);
            dxf.AddEntity(dim1);

            //尺寸2
            LinearDimension dim2 = new LinearDimension(new Line(new Vector2(0, dc / 2), new Vector2(0, -dc / 2)), offset * 2 + dc / 2, 270, dimensionStyle);
            dim2.UserText = "DC = " + Math.Round(dc / scale, 2);
            dxf.AddEntity(dim2);

            //尺寸3
            if (dhub != 0)
            {
                LinearDimension dim3 = new LinearDimension(new Line(v15, v16), -(v16.Y - v17.Y) / 2, 0, dimensionStyle);
                dim3.UserText = "HHUB = " + Math.Round(hhub / scale, 2);
                dxf.AddEntity(dim3);
            }

            //尺寸4
            LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, bcd / 2), new Vector2(0, -bcd / 2)), offset + dc / 2, 270, dimensionStyle);
            dim4.UserText = "BCD = " + Math.Round(bcd / scale, 2);
            dxf.AddEntity(dim4);

            //尺寸5
            LinearDimension dim5 = new LinearDimension(new Line(v22, v15), -v16.Y + v17.Y, 0, dimensionStyle);
            dim5.UserText = "OAL = " + Math.Round(oal / scale, 2);
            dxf.AddEntity(dim5);

            //尺寸6
            LinearDimension dim6 = new LinearDimension(new Line(v33, v36), offset, 270, dimensionStyle);
            dim6.UserText = "DCON = " + Math.Round(dcon / scale, 2);
            dxf.AddEntity(dim6);

            //尺寸7
            if (dhub != 0)
            {
                LinearDimension dim7 = new LinearDimension(new Line(new Vector2(dhub / 2, 0), new Vector2(-dhub / 2, 0)), -offset * 2 - dc / 2, 0, dimensionStyle);
                dim7.UserText = "DHUB = " + Math.Round(dhub / scale, 2);
                dxf.AddEntity(dim7);
            }

            //尺寸9
            if (dbhc != 0)
            {
                LinearDimension dim9 = new LinearDimension(new Line(new Vector2(dbhc / 2, 0), new Vector2(-dbhc / 2, 0)), -offset - dc / 2, 0, dimensionStyle);
                dim9.UserText = "DBHC = " + Math.Round(dbhc / scale, 2);
                dxf.AddEntity(dim9);
            }

            //尺寸11
            if (dah != 0)
            {
                LinearDimension dim11 = new LinearDimension(new Line(new Vector2(-dbhc / 2, dah / 2), new Vector2(-dbhc / 2, -dah / 2)), -offset - (dc - dbhc) / 2, 270, dimensionStyle);
                dim11.UserText = "DAH = " + Math.Round(dah / scale, 2);
                dxf.AddEntity(dim11);
            }

            //图框
            if (isframe == 1)
            {
                Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-147, 148.5));
                fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
            }

            //定义格式，根据路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}
